package com.jerry.seckill.dto;

import com.jerry.seckill.entity.SuccessSeckilled;
import com.jerry.seckill.enums.SeckillStateEnum;

/** 
 * @describe 封装秒杀执行后结果 
 */ 
public class ExecutionResult { 
	
	// 商品库存id
	private long seckillId; 
	// 秒杀执行结果状态 
	private int state; 
	// 秒杀执行结果状态标识 
	private String stateInfo; 
	// 秒杀成功对象 
	private SuccessSeckilled successSeckilled;
	
	public ExecutionResult(long seckillId, SeckillStateEnum stateEnum) {
		super();
		this.seckillId = seckillId;
		this.state = stateEnum.getState();
		this.stateInfo = stateEnum.getStateInfo();
	}
	
	public ExecutionResult(long seckillId, SeckillStateEnum stateEnum, SuccessSeckilled successSeckilled) {
		super();
		this.seckillId = seckillId;
		this.state = stateEnum.getState();
		this.stateInfo = stateEnum.getStateInfo();
		this.successSeckilled = successSeckilled;
	}

	public long getSeckillId() {
		return seckillId;
	}
	public void setSeckillId(long seckillId) {
		this.seckillId = seckillId;
	}
	public int getState() {
		return state;
	}
	public void setState(int state) {
		this.state = state;
	}
	public String getStateInfo() {
		return stateInfo;
	}
	public void setStateInfo(String stateInfo) {
		this.stateInfo = stateInfo;
	}
	public SuccessSeckilled getSuccessSeckilled() {
		return successSeckilled;
	}
	public void setSuccessSeckilled(SuccessSeckilled successSeckilled) {
		this.successSeckilled = successSeckilled;
	}
	
	@Override
	public String toString() {
		StringBuffer sb = new StringBuffer();
		sb.append("seckillId="+seckillId);
		sb.append(",   ");
		sb.append("state="+state);
		sb.append(",   ");
		sb.append("stateInfo="+stateInfo);
		return sb.toString();
	}
}
